Skip to content

Conversation

@TimonBerlin
Copy link
Contributor

The given example doesn’t work anymore because the “parameters” field is now required.
I wasent able to run it without providing a JSON Schema for parameters.

The given example doesn’t work anymore because the “parameters” field is now required.
@changeset-bot
Copy link

changeset-bot bot commented Jul 9, 2025

⚠️ No Changeset found

Latest commit: 9e75efa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for sending this PR! Left a few comments

properties: {},
required: [],
additionalProperties: false
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma is missing:

Suggested change
}
},

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have more time to tweak this, we prefer a slightly simpler one like:

import { Agent, run, tool } from '@openai/agents';
import { z } from 'zod';

const historyFunFact = tool({
  // The name of the tool will be used by the agent to tell what tool to use.
  name: 'history_fun_fact',
  // The description is used to describe **when** to use the tool by telling it **what** it does.
  description: 'Give a fun fact about a historical event',
  // This agent takes no parameters, so we provide an empty JSON schema.
  parameters: z.object({}),
  execute: async () => {
    // The output will be returned back to the Agent to use
    return 'Sharks are older than trees.';
  },
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @seratch, thanks for your response. I had already tried it as you suggested, using an empty Zod object, but I wasn’t able to get it running.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, it is due to #187, which is zod compat issue that we're going to apply workaround soon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should i then go with the empty zod object or keep the json schema ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we consistently use zod as the primary option in the docs and examples, so please go ahead with an empty zod object here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seratch alright done ! Thank you very much :)

@seratch seratch added dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation and removed dependencies Pull requests that update a dependency file labels Jul 10, 2025
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thank you!

@seratch seratch merged commit e07ac8e into openai:main Jul 10, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants